import { Fragment } from 'react';
import { AreaNumManageAPI } from '../common/type';
import fromStyle from '@/common/pageLayout.less';
import { Form, Input } from 'antd';

/**
 * 定义行政区域表单信息
 * @param param0
 * @returns
 */
const UpdateFormColumns: React.FC<AreaNumManageAPI.IUpdateFormColumns> = ({
  checkedRows,
  areaNumUpdateForm,
}) => {
  return (
    <Fragment>
      <div className={fromStyle['fromView-styles']}>
        <Form
          form={areaNumUpdateForm}
          name={'areanum-append'}
          autoComplete={'off'}
        >
          <Form.Item
            name="provinceCode"
            label="省份编码"
            initialValue={checkedRows?.provinceCode}
            rules={[
              {
                required: true,
                message: '请输入省份编码',
                pattern: new RegExp('^[0-9][0-9]*$'),
              },
            ]}
          >
            <Input placeholder={'请输入省份编码'} />
          </Form.Item>
          <Form.Item
            name="provinceName"
            label="省份名称"
            initialValue={checkedRows?.provinceName}
            rules={[
              {
                required: true,
                message: '请输入省份名称',
              },
            ]}
          >
            <Input placeholder={'请输入省份名称'} />
          </Form.Item>
          <Form.Item
            name="cityCode"
            label="市区编码"
            initialValue={checkedRows?.cityCode}
            rules={[
              {
                required: true,
                message: '请输入市区编码',
                pattern: new RegExp('^[0-9][0-9]*$'),
              },
            ]}
          >
            <Input placeholder={'请输入市区编码'} />
          </Form.Item>
          <Form.Item
            name="cityName"
            label="市区名称"
            initialValue={checkedRows?.cityName}
            rules={[
              {
                required: true,
                message: '请输入市区名称',
              },
            ]}
          >
            <Input placeholder={'请输入市区名称'} />
          </Form.Item>
          <Form.Item
            name="countyCode"
            label="区县编码"
            initialValue={checkedRows?.countyCode}
            rules={[
              {
                required: true,
                message: '请输入区县编码',
                pattern: new RegExp('^[0-9][0-9]*$'),
              },
            ]}
          >
            <Input placeholder={'请输入区县编码'} />
          </Form.Item>
          <Form.Item
            name="countyName"
            label="区县名称"
            initialValue={checkedRows?.countyName}
            rules={[
              {
                required: true,
                message: '请输入区县名称',
              },
            ]}
          >
            <Input placeholder={'请输入区县名称'} />
          </Form.Item>
          <Form.Item
            name="remark"
            label="备注"
            initialValue={checkedRows?.remark}
          >
            <Input.TextArea
              placeholder={'请输入备注信息'}
              showCount
              maxLength={200}
              autoSize={{ maxRows: 4, minRows: 2 }}
              allowClear
            />
          </Form.Item>
        </Form>
      </div>
    </Fragment>
  );
};
export { UpdateFormColumns };
